package cn.iocoder.yudao.module.squaredancing.dal.mysql.version;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.squaredancing.dal.dataobject.version.VersionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.squaredancing.controller.admin.version.vo.*;

/**
 * 版本管理 Mapper
 *
 * @author 赵云安
 */
@Mapper
public interface VersionMapper extends BaseMapperX<VersionDO> {

    default PageResult<VersionDO> selectPage(VersionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VersionDO>()
                .eqIfPresent(VersionDO::getVersionCode, reqVO.getVersionCode())
                .likeIfPresent(VersionDO::getVersionName, reqVO.getVersionName())
                .eqIfPresent(VersionDO::getDownloadUrl, reqVO.getDownloadUrl())
                .betweenIfPresent(VersionDO::getForceUpdate, reqVO.getForceUpdate())
                .eqIfPresent(VersionDO::getReleaseNotes, reqVO.getReleaseNotes())
                .betweenIfPresent(VersionDO::getPublishTime, reqVO.getPublishTime())
                .betweenIfPresent(VersionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VersionDO::getId));
    }

}